<?php
/* -----------------------------------------------------------------
 * 	$Id: show_data.php 1432 2015-02-05 15:03:00Z akausch $
 * 	Copyright (c) 2011-2021 commerce:SEO by Webdesign Erfurt
 * 	http://www.commerce-seo.de
 * ------------------------------------------------------------------
 * 	based on:
 * 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
 * 	(c) 2002-2003 osCommerce - www.oscommerce.com
 * 	(c) 2003     nextcommerce - www.nextcommerce.org
 * 	(c) 2005     xt:Commerce - www.xt-commerce.com
 * 	Released under the GNU General Public License
 * --------------------------------------------------------------- */
include ('includes/application_top.php');
if (isset($_POST['dataid']) && $_POST['dataid'] != '') {
    $MYPOSTDATE = explode('_', $_POST['dataid']);
    $MYDATUM = explode('-', $MYPOSTDATE[3]);
    $my_calender .= '<div aria-hidden="true" aria-labelledby="' . $_POST['dataid'] . '_modal_title" role="dialog" tabindex="-1" id="' . $_POST['dataid'] . '_modal" class="modal fade in" style="display:block;" dateid="' . $_POST['dataid'] . '">';
    $my_calender .= '<div class="modal-dialog"><div class="modal-content"><div class="modal-header"><h4 id="' . $_POST['dataid'] . '_modal_title" class="modal-title">Termine für den ' . $MYDATUM[2] . '.' . $MYDATUM[1] . '.' . $MYDATUM[0] . '</h4></div>';
    $my_calender .= '<div id="' . $_POST['dataid'] . '_modal_body" class="modal-body">';
    $calender_query = xtc_db_query("SELECT * FROM blog_items WHERE calender > 0
            AND 
                (
                    (DATE(datestart) <= '" . $MYPOSTDATE[3] . "' AND (DATE(dateend) >= '" . $MYPOSTDATE[3] . "' AND DATE(dateend) != '0000-00-00'))
            OR
                    (DATE(datestart) = '" . $MYPOSTDATE[3] . "' AND (DATE(dateend) = '0000-00-00' OR DATE(dateend) = DATE(datestart)))
                )
            AND status = '2' AND language_id = '" . (int) $_SESSION['languages_id'] . "' ");
    while ($calender = xtc_db_fetch_array($calender_query)) {
        $link = xtc_href_link('blog.php', 'blog_cat='.$calender['categories_id'].'&blog_item='.$calender['item_id']);
        $my_calender .= '<p><h2>' . $calender['name'] . '</h2>';
        $my_calender .= $calender['shortdesc'];
        $my_calender .= '<h5><a href ="'.$link.'">zum Termin</a></h5>';
        $my_calender .= '</p><br><br>';
    }
    $my_calender .= '</div><div id="' . $_POST['dataid'] . '_modal_footer" class="modal-footer">';
    $my_calender .= '<div><button onclick="dateId = $(this).closest(\'.modal\').attr(\'dateId\'); myDateFunction(dateId, true);" class="btn btn-primary" type="button">Fenster schliessen</button></div></div></div></div></div>';
    echo $my_calender;
}